#ifndef Plot_3D_h__2005_07_10_10_46_begin_guarded_code
#define Plot_3D_h__2005_07_10_10_46_begin_guarded_code

#include <QMenu>
#include <QObject>
#include <QToolBar>
#include <QAction>
#include <QActionGroup>
#include <QMainWindow>
#include <QComboBox>
#include <QMenuBar>
#include <QGridLayout>
#include <QFrame>
#include <QColorDialog>
#include <QFileDialog>
#include <QFontDialog>
#include <QFont>
#include <QTimer>
#include <QColor>
#include <QStatusBar>
#include <QFileInfo>
#include <QFile>
#include <QCheckBox>
#include <QString>
#include <QMetaObject>

#include <QLabel>
#include <QImage>
#include <QPixmap>
#include <QSlider>

#include <qwt3d_io.h>
#include <qwt3d_io_gl2ps.h>
#include <qwt3d_io_reader.h>
#include <qwt3d_surfaceplot.h>

#include "functions.h"

#include <fstream>
//#include <qcolordialog.h>
//#include <qfontdialog.h>
class LightingDlg;
class ColorMapPreview;

class Plot_3D : public SurfacePlot
{

    Q_OBJECT
public:
    Plot_3D(QWidget* = NULL);
    QMenuBar *menubar;
    QMenu *filemenu;
    QMenu *colormenu;
    QMenu *fontmenu;
    QToolBar *mainToolbar;
    QToolBar *csToolbar;
    QAction* openFile;

    QAction* animation;
    QAction* dump;
    QAction* normals;
    QAction* Exit;


    QActionGroup* coord;
    QAction* Box;
    QAction* Frame;
    QAction* None;
    QFrame *SPL_Plot_3D_frame;
    QActionGroup* plotstyle;
    QAction* wireframe;
    QAction* hiddenline;
    QAction* polygon;
    QAction* filledmesh;
    QAction* nodata;
    QAction* pointstyle;

    QActionGroup* color;
    QAction* axescolor;
    QAction* backgroundcolor;
    QAction* meshcolor;
    QAction* numbercolor;
    QAction* labelcolor;
    QAction* titlecolor;
    QAction* datacolor;
    QAction* resetcolor;

    QActionGroup* font;
    QAction* numberfont;
    QAction* labelfont;
    QAction* titlefont;
    QAction* resetfont;

    QActionGroup* floorstyle;
    QAction* floordata;
    QAction* flooriso;
    QAction* floornone;

    QActionGroup* grids;
    QAction* front;
    QAction* back;
    QAction* right;
    QAction* left;
    QAction* ceil;
    QAction* floor;

    QComboBox* filetypeCB, *functionCB, *psurfaceCB;

    void setupWorkaround(QWidget* mw);

    Qwt3D::SurfacePlot* dataWidget;
    int redrawWait;

    QAction* activeCoordSystem;

    bool legend_;
    Qwt3D::StandardColor* col_;
public slots:
    //void open();
    //void openMesh();

    void createFunction(QString const& name);
    void pickCoordSystem( QAction* );

    void createPSurface(QString const& name);
    //void setFileType(QString const& name);


    void pickPlotStyle( QAction* );
    void pickFloorStyle( QAction* );
void resetColors();

    void setStandardView();
    void dumpImage();
    void toggleAnimation(bool);
    void toggleProjectionMode(bool);
    void toggleColorLegend(bool);
    void toggleAutoScale(bool val);
    void toggleShader(bool val);
    void rotate();
    void setPolygonOffset(int);

    void showRotate(double x, double y, double z);
    void showShift(double x, double y);
    void showScale(double x, double y, double z);
    void showZoom(double z);
    void showNormals(bool val);
    void setNormalQuality(int);
    void setNormalLength(int);




    void setLeftGrid( bool b );
    void setRightGrid( bool b );
    void setCeilGrid( bool b );
    void setFloorGrid( bool b );
    void setFrontGrid( bool b );
    void setBackGrid( bool b );
    void setGrid( Qwt3D::SIDE, bool );


private:
    QLabel *filenameWidget, *dimWidget,
    *rotateLabel, *shiftLabel, *scaleLabel, *zoomLabel;

    QTimer* timer;


    QFileDialog* datacolordlg_;
    LightingDlg* lightingdlg_;
    QString filetype_;


};

#endif
